// eslint-disable-next-line
<!--{{this.$store.state}}}-->
<template>
  <div class="index">
    <!-- <button @click="clickButton2()">关闭轮询</button> -->
    <div class="header">
      <!-- <h1>工业互联网纺织大数据管理中心</h1> -->
      <Legend :status="status" />
      <div class="xiaolv"/>
    </div>
    <div class="content" :style="contentStyle">
      <div class="row1Style">
        <div class="row">
          <div class="box_top">
            <div class="boxItem"></div>
            <div class="content_body">
              <!-- 络筒 -->
              <LuoTong />
              <i class="wall"></i>
              <!-- 细纱1 -->
              <XiSha1 />
              <i class="wall ceil"></i>
              <!-- 细纱2 -->
              <XiSha2 />
              <i class="wall ceil"></i>
              <!-- 粗纱2 -->
              <CuSha />
              <!-- 并条 -->
              <JingTiao />
              <!-- 梳棉 -->
              <ShuMian />
              <i class="wall"></i>
              <!-- 清花 -->
              <QingHua />
            </div>
          </div>
        </div>
      </div>
      <div class="rowStyle">
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>
              <div class="box_header">
                <span class="box_header_text">当班各工序产量</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <echarts1></echarts1>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>

              <div class="box_header">
                <span class="box_header_text">细纱各品种产量</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <echarts2></echarts2>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>

              <div class="box_header">
                <span class="box_header_text">自络各品种产量</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <echarts3></echarts3>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>

              <div class="box_header">
                <span class="box_header_text">车间开台比例</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <div class="echarts_group">
                <div class="echarts4">
                  <echarts4></echarts4>
                </div>
                <div class="echarts5">
                  <echarts5></echarts5>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="rowStyle">
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>
              <div class="box_header">
                <span class="box_header_text">空压机系统</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <div class="echarts_group_3">
                <div class="echarts_item">
                  <echarts12></echarts12>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>
              <div class="box_header">
                <span class="box_header_text">温湿度</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <div class="echarts_group_1" id="echart7Group">
                <div class="echarts_left">
                  <!-- <el-tooltip
                    placement="top"
                    :open-delay="500"
                    v-model="tooltipShow"
                    effect="dark"
                    :content="
                      '机器：' +
                      toolTipBody.pro +
                      '</br>电耗：' +
                      toolTipBody.impEp +
                      'kW‧h'
                    "
                  >
                    <div slot="content">
                      机器: {{ toolTipBody.pro }}
                      <br />
                      电耗: {{ toolTipBody.impEp }}kW‧h
                    </div> -->
                  <el-table
                    ref="table"
                    :data="tableData"
                    @row-click="handleCurrentChange"
                    :max-height="echart7Height"
                  >
                    <el-table-column prop="machineName" label="机器" width="60">
                      <template slot-scope="{ row }">
                        {{
                          row.machineName
                            ? row.machineName.split("温度").join("")
                            : ""
                        }}
                      </template>
                    </el-table-column>
                    <el-table-column
                      prop="temp"
                      label="温度"
                      width="55"
                      :formatter="fixedFloat"
                    ></el-table-column>
                    <el-table-column
                      prop="humidity"
                      label="湿度"
                      width="55"
                      :formatter="fixedFloat"
                    ></el-table-column>
                  </el-table>
                  <!-- </el-tooltip> -->
                </div>
                <div class="echarts_right">
                  <div class="echarts7">
                    <echarts7></echarts7>
                  </div>
                  <!-- <div class="echarts8">
                    <echarts8></echarts8>
                  </div> -->
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>
              <div class="box_header">
                <span class="box_header_text">当前电耗</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <div class="echarts_group_2">
                <div class="echarts_top">
                  <echarts9 ref="parent_echarts9"></echarts9>
                </div>

                <div class="echarts_bottom">
                  <div class="echarts_bottom_left">
                    <echarts10></echarts10>
                  </div>
                  <div class="echarts_bottom_right">
                    <echarts11></echarts11>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="rowStyle_6">
          <div class="row">
            <div class="box">
              <div class="boxItem"></div>
              <div class="box_header">
                <span class="box_header_text">车间用工</span>
                <img
                  class="box_header_img"
                  src="../../assets/img/ksh33.png"
                  alt=""
                />
              </div>
              <echarts6></echarts6>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- 空调弹窗控件 -->
    <kongTiaoDialog ref="kongTiaoDialog"></kongTiaoDialog>
  </div>
</template>

<script>
import moment from "moment";
import echarts1 from "./components/echarts1";
import echarts2 from "./components/echarts2";
import echarts3 from "./components/echarts3";
import echarts4 from "./components/echarts4";
import echarts5 from "./components/echarts5";
import echarts6 from "./components/echarts6";
import echarts7 from "./components/echarts7";
import echarts8 from "./components/echarts8";
import echarts9 from "./components/echarts9";
import echarts10 from "./components/echarts10";
import echarts11 from "./components/echarts11";
import echarts12 from "./components/echarts12";
// ===========================
import XiSha1 from "../../components/XiSha1";
import XiSha2 from "../../components/XiSha2";
import CuSha from "../../components/CuSha";
import JingTiao from "../../components/JingTiao";
import ShuMian from "../../components/ShuMian";
import LuoTong from "../../components/LuoTong";
import QingHua from "../../components/QingHua";
//============================
import kongTiaoDialog from "./components/dialog/dialog_kongtiao/index";
import Legend from "../../components/Legend";
export default {
  data() {
    return {
      // 一级轮训定时器
      timer: "",
      // 1.5轮询定时器
      inlineTimer: "",
      secXishaGroupTimer: "",
      secCushaGroupTimer: "",
      secLuotongGroupTimer: "",
      secJingtiaoGroupTimer: "",
      secShumianGroupTimer: "",
      secQinghuaGroupTimer: "",
      currentRow: null,

      // 二级轮询定时器
      secXiShaTimer: "",
      secTxcsomlTimer: "",
      secCuShaJiTimer: "",
      secBingTiaoTimer: "",
      secShuMianJiTimer: "",
      secShuMianJiATimer: "",
      secLuoTongTimer: "",
      secLuoTongTimerA: "",
      secDuoCangTimer: "",
      secZhuaMianTimer: "",
      secKaiMianTimer: "",
      loading: true,
      tableData: [
        { index: 4, pro: "细纱4", wen: 0, shi: 0, flag: "xs4" },
        { index: 5, pro: "细纱5", wen: 0, shi: 0, flag: "xs5" },
        { index: 6, pro: "细纱6", wen: 0, shi: 0, flag: "xs6" },
        { index: 7, pro: "细纱7", wen: 0, shi: 0, flag: "xs7" },
      ],
      haoDianList: [],
      kongTiaoData: [],
      kongYaData: [],
      kongYaDataSum: {},
      luoTongDialog: false,
      xishaDialog: false,
      tooltipShow: false,
      kongTiaoDataSum: {},
      data7: null,
      echart7Height: 0,
      toolTipBody: {
        pro: "",
        impEp: 0,
      },
      luoTongDialogData: "",
      contentStyle: {
        height: 0,
      },
      status: [
        { label: "运行", data: 0 },
        { label: "停止", data: 0 },
        { label: "故障", data: 0 },
        { label: "满纱满桶", data: 0 },
        { label: "通讯失败", data: 0 },
        { label: "计划停台", data: 0 },
      ],
    };
  },
  components: {
    // ===========================
    XiSha1,
    XiSha2,
    CuSha,
    JingTiao,
    ShuMian,
    LuoTong,
    QingHua,
    // ==========================
    echarts1,
    echarts2,
    echarts3,
    echarts4,
    echarts5,
    echarts6,
    echarts7,
    echarts8,
    echarts9,
    echarts10,
    echarts11,
    echarts12,
    kongTiaoDialog,
    Legend,
  },
  computed: {
    runningStatus() {
      return this.$store.state.runningStatus;
    },
    wenShiGroupState() {
      return this.$store.state.wenShiGroupState;
    },
    wenShiGroupStateList() {
      return this.$store.state.wenShiGroupStateList;
    },
    kongTiaoGroupState() {
      return this.$store.state.kongTiaoGroupState;
    },
    kongYaGroupState() {
      return this.$store.state.kongYaGroupState;
    },
  },
  watch: {
    runningStatus: {
      immediate: true,
      handler(val) {
        if (val.code == 1) {
          this.status = [
            { label: "运行", data: 0 },
            { label: "停止", data: 0 },
            { label: "故障", data: 0 },
            { label: "满纱满桶", data: 0 },
            { label: "通讯失败", data: 0 },
            { label: "计划停台", data: 0 },
          ];
          let { data } = val;
          for (let i = 0; i < data.length; i++) {
            this.status[parseInt(data[i]["stateCode"]) - 1]["data"] += parseInt(
              data[i]["num"]
            );
          }
        }
      },
    },
    wenShiGroupState: {
      immediate: true,
      handler(val) {
        if (val.code == 1) {
          let { data } = val;
          this.tableData = data;
          this.$refs["table"].setCurrentRow(data[0]);
          this.$store.dispatch("actWenShiGroupList", {
            machineNumber: data[0]["machineNumber"],
          });
        }
      },
    },
    wenShiGroupStateList: {
      immediate: true,
      handler(val) {
        if (val.code == 1) {
          let { data } = val;
          let time = [],
            temp = [],
            humidity = [];
          data.data.map((item) => {
            time.push(item.time);
            temp.push(parseFloat(item.temp).toFixed(1));
            humidity.push(parseFloat(item.humidity).toFixed(1));
          });
          var wsEchartsData = {
            name: data.id,
            date: time,
            wen: temp,
            shi: humidity,
          };
          this.$store.dispatch("actWenShiData", wsEchartsData);
        }
      },
    },
    kongTiaoGroupState: {
      immediate: true,
      handler(val) {
        if (val.code == 1) {
          this.kongTiaoData = val.data.list;
          this.kongTiaoDataSum = val.data.sum;
        }
      },
    },
    kongYaGroupState: {
      immediate: true,
      handler(val) {
        if (val.code == 1) {
          this.kongYaData = val.data.dlgList;
          this.kongYaDataSum = val.data.dlgSum;
        }
      },
    },
  },
  created() {
    /**
     * 获取分组数据
     * */
    this.clickButton();
    this.changeHeight();
    this.$EventBus.$on("inlineDialog", (isOpen, type, devSn, onlyTable) => {
      if (isOpen == "open") {
        this.openInlineDialog(type, devSn, onlyTable);
      } else {
        this.closeInlineDialog();
      }
    });
    this.$EventBus.$on("getInfoByDevSn", (type, devSn) => {
      this.getInfoByDevSn(type, devSn);
    });
    // 关闭某个定时器
    this.$EventBus.$on("clearTypeInterval", (timer) => {
      clearInterval(this[timer]);
    });
  },
  mounted() {
    this.cancelLoading();
    //头部高度初始化
    window.addEventListener("resize", this.changeHeight);
    this.$nextTick(() => {
      this.echart7Height = document.querySelector("#echart7Group").offsetHeight;
    });
  },
  beforeDestroy() {
    this.$EventBus.$off("getInfoByDevSn");
  },
  methods: {
    showKongYaDialog(index) {
      //显示空调+空压弹窗
      this.$refs.kongTiaoDialog.showDialog(
        this.kongYaDataSum,
        this.kongYaData,
        "空压机"
      );
    },
    wenShiDataUtils(dataList, flag) {
      var that = this;
      var wsEchartsData = {
        name: "",
        date: [],
        wen: [],
        shi: [],
      };
      dataList.forEach((element) => {
        var hour = moment(element.time).format("hh:00"); //这里转成需要的格式
        wsEchartsData.date.push(hour);
        switch (flag) {
          //运行
          case "xs4":
            wsEchartsData.name = "细纱4";
            wsEchartsData.wen.push(parseFloat(element.xswd4).toFixed(2));
            wsEchartsData.shi.push(parseFloat(element.xssd4).toFixed(2));
            break;
          //停止
          case "xs5":
            wsEchartsData.name = "细纱5";
            wsEchartsData.wen.push(parseFloat(element.xswd5).toFixed(2));
            wsEchartsData.shi.push(parseFloat(element.xssd5).toFixed(2));
            break;
          //故障
          case "xs6":
            wsEchartsData.name = "细纱6";
            wsEchartsData.wen.push(parseFloat(element.xswd6).toFixed(2));
            wsEchartsData.shi.push(parseFloat(element.xssd6).toFixed(2));
            break;
          //满纱满桶
          case "xs7":
            wsEchartsData.name = "细纱7";
            wsEchartsData.wen.push(parseFloat(element.bnwd7).toFixed(2));
            wsEchartsData.shi.push(parseFloat(element.bnsd7).toFixed(2));
            break;
        }
      });
      this.$store.dispatch("actWenShiData", wsEchartsData);
    },

    handleCurrentChange(val) {
      this.$store.dispatch("actWenShiGroupList", {
        machineNumber: val["machineNumber"],
      });
    },

    /**
     * 关闭弹窗触发事件
     */
    closeParentHandle() {
      // console.log("关闭弹窗触发事件")
      // this.$message('关闭二级轮询');
      // 清除二级轮询
      clearInterval(this.secXiShaTimer);
      clearInterval(this.secBingTiaoTimer);
      clearInterval(this.secShuMianJiTimer);
      clearInterval(this.secShuMianJiATimer);
      clearInterval(this.secTxcsomlTimer);
      clearInterval(this.secLuoTongTimer);
      clearInterval(this.secLuoTongTimerA);
      clearInterval(this.secDuoCangTimer);
      clearInterval(this.secZhuaMianTimer);
      clearInterval(this.secKaiMianTimer);
      clearInterval(this.secCuShaJiTimer);
      // clearInterval(this.secDongLiTimer);
      // 清除1.5级的轮询
      clearInterval(this.inlineTimer);
      clearInterval(this.secXishaGroupTimer);
      clearInterval(this.secCushaGroupTimer);
      clearInterval(this.secLuotongGroupTimer);
      clearInterval(this.secJingtiaoGroupTimer);
      clearInterval(this.secShumianGroupTimer);
      clearInterval(this.secQinghuaGroupTimer);
      // 开启一级轮询
      // this.clickButton();
    },
    /**
     * 获取实时数据
     * */
    getInfoByDevSn(type, devSn) {
      const time = 1000 * 60;
      //关闭一级查询
      // clearInterval(this.timer);
      switch (type) {
        case "XISHA":
          // 获取细纱实时数据
          this.$store.dispatch("actXiShaNewest", { devSn });
          this.$store.dispatch("acXishaLineNewest", { devSn });
          this.secXiShaTimer = setInterval(() => {
            this.$store.dispatch("actXiShaNewest", { devSn });
            this.$store.dispatch("acXishaLineNewest", { devSn });
          }, time);
          break;
        case "BINGTIAO":
          // 获取并条实时数据
          this.$store.dispatch("actBingTiaoNewest", { devSn });
          this.secBingTiaoTimer = setInterval(() => {
            this.$store.dispatch("actBingTiaoNewest", { devSn });
          }, time);
          break;
        case "SHUMIANJI": // 梳棉机，梳棉机A都在这处理
          // 获取梳棉机实时数据
          if (devSn <= 16) {
            // 梳棉机
            this.$store.dispatch("actShuMianJiNewest", { devSn });
            this.secShuMianJiTimer = setInterval(() => {
              this.$store.dispatch("actShuMianJiNewest", { devSn });
            }, time);
          } else {
            // 梳棉机A
            this.$store.dispatch("actShuMianJiANewest", { devSn });
            this.secShuMianJiATimer = setInterval(() => {
              this.$store.dispatch("actShuMianJiANewest", { devSn });
            }, time);
          }
          break;
        case "TXCSOML":
          // 获取太行粗纱欧姆龙实时数据
          this.$store.dispatch("actTxcsomlNewest", { devSn });
          this.secTxcsomlTimer = setInterval(() => {
            this.$store.dispatch("actTxcsomlNewest", { devSn });
          }, time);
          break;
        case "CUSHA":
          // 获取新粗纱机器实时数据
          this.$store.dispatch("actCuShaJiNewest", { devSn });
          this.secCuShaJiTimer = setInterval(() => {
            this.$store.dispatch("actCuShaJiNewest", { devSn });
          }, time);
          break;
        case "LUOTONG":
          // 获取络筒实时数据
          this.$store.dispatch("actLuoTongNewest", { devSn });
          this.secLuoTongTimer = setInterval(() => {
            this.$store.dispatch("actLuoTongNewest", { devSn });
          }, time);
          // 获取络筒分组数据
          this.$store.dispatch("actLuoTongGroup1", { devSn });
          this.secLuoTongTimerA = setInterval(() => {
            this.$store.dispatch("actLuoTongGroup1", { devSn });
          }, time);
          break;
        case "DUOCANG":
          // 获取络筒实时数据
          this.$store.dispatch("actDuoCangNewest", { devSn });
          this.secDuoCangTimer = setInterval(() => {
            this.$store.dispatch("actDuoCangNewest", { devSn });
          }, time);
          break;
        case "ZHUAMIAN":
          // 获取络筒实时数据
          this.$store.dispatch("actZhuaMianNewest", { devSn });
          this.secZhuaMianTimer = setInterval(() => {
            this.$store.dispatch("actZhuaMianNewest", { devSn });
          }, time);
          break;
        case "KAIMIAN":
          // 获取络筒实时数据
          this.$store.dispatch("actKaiMianNewest", { devSn });
          this.secKaiMianTimer = setInterval(() => {
            this.$store.dispatch("actKaiMianNewest", { devSn });
          }, time);
          break;
        case "DONGLI":
          // 获取络筒实时数据
          this.$store.dispatch("actDongLiNewest", devSn);
          // this.secDongLiTimer = setInterval(() => {
          //   this.$store.dispatch("actDongLiNewest", devSn);
          // }, time);
          break;
        default:
          break;
      }
    },
    clickButton() {
      this.$store.commit("removeAllNewest");
      // 初始化一级数据
      // 获取温湿度分组数据
      this.$store.dispatch("actWenShiGroup");
      // 获取细纱分组数据
      this.$store.dispatch("actXiShaGroup");
      // // 获取并条分组数据
      this.$store.dispatch("actBingTiaoGroup");
      // // 获取梳棉机分组数据
      this.$store.dispatch("actShuMianJiGroup");
      // // 获取太行粗纱欧姆龙分组数据
      this.$store.dispatch("actTxcsomlGroup");
      // // 获取络筒分组数据
      this.$store.dispatch("actLuoTongGroup");
      // // 获取抓棉分组数据
      this.$store.dispatch("actZhuaMianGroup");
      // // 获取多仓分组数据
      this.$store.dispatch("actDuoCangGroup");
      // // 获取开棉机分组数据
      this.$store.dispatch("actKaiMianGroup");
      // // 获取清花分组数据
      //  this.$store.dispatch("actQingHuaGroup");
      // 获取电表数据
      this.$store.dispatch("actDianBiaoGroup");
      // 获取Echarts1数据
      this.$store.dispatch("actEcharts1");
      // 获取Echarts2数据
      this.$store.dispatch("actEcharts2");
      // 获取Echarts3数据
      this.$store.dispatch("actEcharts3");
      // 获取Echarts4数据
      this.$store.dispatch("actEcharts4");
      // 获取Echarts5数据
      this.$store.dispatch("actEcharts5");
      // 获取Echarts6数据
      this.$store.dispatch("actEcharts6");
      // 获取Echarts7数据
      //this.$store.dispatch("actEcharts7");
      // 获取Echarts8数据
      //this.$store.dispatch("actEcharts8");
      // 获取Echarts10数据
      //this.$store.dispatch("actEcharts10");
      // 获取Echarts11数据
      //this.$store.dispatch("actEcharts11");
      //获取Echarts12数据
      this.$store.dispatch("actEcharts12");
      // 获取空调能耗数据
      this.$store.dispatch("actKongTiaoGroup");
      // 获取空压能耗数据
      this.$store.dispatch("actKongYaGroup", [
        { start: 0, end: 100, gongxu: "空压" },
      ]);
      // 获取状态数
      this.$store.dispatch("acRunningStatusNewest");
      this.timer = setInterval(() => {
        //获取温湿度表格
        this.$store.dispatch("actWenShiGroup");
        // 获取细纱分组数据
        this.$store.dispatch("actXiShaGroup");
        // 获取并条分组数据
        this.$store.dispatch("actBingTiaoGroup");
        // 获取梳棉机分组数据
        this.$store.dispatch("actShuMianJiGroup");
        // 获取太行粗纱欧姆龙数据
        this.$store.dispatch("actTxcsomlGroup");
        // 获取络筒数据
        this.$store.dispatch("actLuoTongGroup");
        // 获取抓棉分组数据
        this.$store.dispatch("actZhuaMianGroup");
        // 获取多仓数据
        this.$store.dispatch("actDuoCangGroup");
        // 获取开棉机分组数据
        this.$store.dispatch("actKaiMianGroup");
        // 获取清花分组数据
        //this.$store.dispatch("actQingHuaGroup");
        // 获取电表数据
        this.$store.dispatch("actDianBiaoGroup");
        // 获取Echarts1数据
        this.$store.dispatch("actEcharts1");
        // 获取Echarts2数据
        this.$store.dispatch("actEcharts2");
        // 获取Echarts3数据
        this.$store.dispatch("actEcharts3");
        // 获取Echarts4数据
        this.$store.dispatch("actEcharts4");
        // 获取Echarts5数据
        this.$store.dispatch("actEcharts5");
        // 获取Echarts6数据
        this.$store.dispatch("actEcharts6");
        // 获取Echarts7数据
        //this.$store.dispatch("actEcharts7");
        // 获取Echarts8数据
        //this.$store.dispatch("actEcharts8");
        // 获取Echarts10数据
        //this.$store.dispatch("actEcharts10");
        // 获取Echarts11数据
        //this.$store.dispatch("actEcharts11");
        // 获取Echarts12数据
        this.$store.dispatch("actEcharts12");
        // 获取空调能耗数据
        this.$store.dispatch("actKongTiaoGroup");
        // 获取空压能耗数据
        this.$store.dispatch("actKongYaGroup", [
          { start: 0, end: 100, gongxu: "空压" },
        ]);
        // 获取状态数
        this.$store.dispatch("acRunningStatusNewest");
      }, 1000 * 10);
    },
    clickButton2() {
      // this.$message('关闭一级轮询');
      clearInterval(this.timer);
    },
    // 打开1.5级弹窗轮询事件(类型,传参,是否只刷新弹窗内的表格)
    openInlineDialog(type, devSn, onlyTable) {
      // clearInterval(this.timer);
      const time = 1000 * 60;
      switch (type) {
        case "XISHA":
          // 细砂
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取细纱分组数据
              this.$store.dispatch("actXiShaGroup");
            }, time);
          }
          // 获取1.5级细砂弹窗分组数据
          this.$store.dispatch("actXishaGroupNewest", devSn);
          this.$store.dispatch("actXishaWorkerGroupNewest", { gongxu: "细纱" });
          this.$store.dispatch("actXishaDetailGroupNewest");
          this.$store.dispatch("actXishaWorkerSumGroupNewest");
          this.secXishaGroupTimer = setInterval(() => {
            this.$store.dispatch("actXishaGroupNewest", devSn);
            this.$store.dispatch("actXishaWorkerGroupNewest", {
              gongxu: "细纱",
            });
            this.$store.dispatch("actXishaDetailGroupNewest");
            this.$store.dispatch("actXishaWorkerSumGroupNewest");
          }, time);
          break;
        case "CUSHA":
          // 粗砂
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取粗纱分组数据
              this.$store.dispatch("actTxcsomlGroup");
            }, time);
          }
          // 获取1.5级粗砂弹窗分组数据
          this.$store.dispatch("actCushaGroupNewest", devSn);
          this.$store.dispatch("actCushaWorkerGroupNewest", { gongxu: "粗纱" });
          this.$store.dispatch("actCushaDetailGroupNewest");
          this.$store.dispatch("actCushaWorkerSumGroupNewest");
          this.secCushaGroupTimer = setInterval(() => {
            this.$store.dispatch("actCushaGroupNewest", devSn);
            this.$store.dispatch("actCushaWorkerGroupNewest", {
              gongxu: "粗纱",
            });
            this.$store.dispatch("actCushaDetailGroupNewest");
            this.$store.dispatch("actCushaWorkerSumGroupNewest");
          }, time);
          break;
        case "LUOTONG":
          // 络筒
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取络筒分组数据
              this.$store.dispatch("actLuoTongGroup");
            }, time);
          }
          // 获取1.5级络筒弹窗分组数据
          this.$store.dispatch("actLuotongGroupNewest", devSn);
          this.$store.dispatch("actLuotongWorkerGroupNewest", {
            gongxu: "络筒",
          });
          this.$store.dispatch("actLuotongDetailGroupNewest");
          this.$store.dispatch("actLuotongWorkerSumGroupNewest");
          this.secLuotongGroupTimer = setInterval(() => {
            this.$store.dispatch("actLuotongGroupNewest", devSn);
            this.$store.dispatch("actLuotongWorkerGroupNewest", {
              gongxu: "络筒",
            });
            this.$store.dispatch("actLuotongDetailGroupNewest");
            this.$store.dispatch("actLuotongWorkerSumGroupNewest");
          }, time);
          break;
        case "JINGTIAO":
          // 井条
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取井条分组数据
              this.$store.dispatch("actBingTiaoGroup");
            }, time);
          }
          // 获取1.5级井条弹窗分组数据
          this.$store.dispatch("actJingtiaoGroupNewest", devSn);
          this.$store.dispatch("actJingtiaoWorkerGroupNewest", {
            gongxu: "并条",
          });
          this.$store.dispatch("actJingtiaoDetailGroupNewest");
          this.$store.dispatch("actJingtiaoWorkerSumGroupNewest");
          this.secJingtiaoGroupTimer = setInterval(() => {
            this.$store.dispatch("actJingtiaoGroupNewest", devSn);
            this.$store.dispatch("actJingtiaoWorkerGroupNewest", {
              gongxu: "并条",
            });
            this.$store.dispatch("actJingtiaoDetailGroupNewest");
            this.$store.dispatch("actJingtiaoWorkerSumGroupNewest");
          }, time);
          break;
        case "SHUMIAN":
          // 梳棉
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取梳棉分组数据
              this.$store.dispatch("actShuMianJiGroup");
            }, time);
          }
          // 获取1.5级梳棉弹窗分组数据
          this.$store.dispatch("actShumianGroupNewest", devSn);
          this.$store.dispatch("actShumianWorkerGroupNewest", {
            gongxu: "梳棉",
          });
          this.$store.dispatch("actShumianDetailGroupNewest");
          this.$store.dispatch("actShumianWorkerSumGroupNewest");
          this.secShumianGroupTimer = setInterval(() => {
            this.$store.dispatch("actShumianGroupNewest", devSn);
            this.$store.dispatch("actShumianWorkerGroupNewest", {
              gongxu: "梳棉",
            });
            this.$store.dispatch("actShumianDetailGroupNewest");
            this.$store.dispatch("actShumianWorkerSumGroupNewest");
          }, time);
          break;
        case "QINGHUA":
          // 清花
          if (!onlyTable) {
            this.inlineTimer = setInterval(() => {
              // 获取清花分组数据
              // this.$store.dispatch("actQingHuaGroup");
              // // 获取抓棉分组数据
              this.$store.dispatch("actZhuaMianGroup");
              // // 获取多仓分组数据
              this.$store.dispatch("actDuoCangGroup");
              // // 获取开棉机分组数据
              this.$store.dispatch("actKaiMianGroup");
            }, time);
          }
          // 获取1.5级清花弹窗分组数据
          this.$store.dispatch("actQinghuaGroupNewest", devSn);
          this.$store.dispatch("actQinghuaWorkerGroupNewest", {
            gongxu: "清花",
          });
          this.$store.dispatch("actQinghuaDetailGroupNewest");
          this.$store.dispatch("actQinghuaWorkerSumGroupNewest");
          this.secQinghuaGroupTimer = setInterval(() => {
            this.$store.dispatch("actQinghuaGroupNewest", devSn);
            this.$store.dispatch("actQinghuaWorkerGroupNewest", {
              gongxu: "清花",
            });
            this.$store.dispatch("actQinghuaDetailGroupNewest");
            this.$store.dispatch("actQinghuaWorkerSumGroupNewest");
          }, time);
          break;
      }
    },
    // 关闭1.5级轮询
    closeInlineDialog() {
      clearInterval(this.inlineTimer);
      clearInterval(this.secXishaGroupTimer);
      clearInterval(this.secCushaGroupTimer);
      clearInterval(this.secLuotongGroupTimer);
      clearInterval(this.secJingtiaoGroupTimer);
      clearInterval(this.secShumianGroupTimer);
      clearInterval(this.secQinghuaGroupTimer);
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    },
    //设置元素动态高度
    changeHeight() {
      this.contentStyle.height = window.innerHeight - 110 + "px";
    },
    fixedFloat(row, col, value) {
      value = parseFloat(value);
      return value.toFixed(1);
    },
  },
};
</script>

<style lang="scss"></style>
